package com.haojiang.mh.service

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.wifi.WifiManager
import com.haojiang.mh.cache.Const
import com.haojiang.mh.service.event.OneEvent
import org.greenrobot.eventbus.EventBus

/**
 * WiFi扫描结果监听
 *
 * Created by ZapFive on 2019-05-25.
 *
 * wuzhuang@mirahome.me
 */
class WiFiScanResultReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context?, intent: Intent?) {
        if (context == null) return
        if (intent?.action == WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) {
            EventBus.getDefault().post(OneEvent(Const.SCAN_WIFI_RESULT))
        }
    }
}